<?php
class searchController extends Controller{
	/*
	 * 头部搜索
	 */
	 public function index(){
	 	if(IS_POST){
	 		
	 		header("Content-type:text/html;charset=utf8");  //调试开启
	 		$searchWord =htmlspecialchars($_POST['searchWord']); //搜索文本
			$searValue = M('hd_snser')->query("select ask.content as askcontent,ask.asid,ask.answer,ask.time,cate.title,answer.content from hd_ask as ask join hd_category as cate on ask.cid=cate.cid join hd_answer as answer on ask.asid=answer.asid where ask.content like '%{$searchWord}%' or answer.content like '%{$searchWord}%'  ");
//			var_dump($searValue);
			 $this->assign('searchValue', $searValue);
	 	}
		$this->display();
	 }
} 